package com.wkq.domain;

import com.wkq.util.Date_Util;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Orders {
    private String id;//主键id，无任何意义
    private String orderNum;//订单编号，不为空，唯一
    private Date orderTime;//下单时间
    private String orderTimeStr;
    private int orderStatus;//订单状态
    private String orderStatusStr;
    private int peopleCount;//出行人数
//    private String productName;//订单对应的产品名称
//    private String productPrice;//订单对应的产品价格
    private int productId;
    private Product product;
    private List<Traveller> travellers;//订单对应的旅客
    private int memberId;
    private Member member;//订单对应的会员信息
    private Integer payType;//订单的支付方式
    private String payTypeStr;
    private String orderDesc;

    public String getPayTypeStr() {
        if (payType != null) {
            if (payType == 0) {
                payTypeStr = "支付宝";
            } else if (payType == 1){
                payTypeStr = "微信";
            } else {
                payTypeStr = "其他";
            }
        }
        return payTypeStr;
    }

    public String getOrderTimeStr() {
        if (orderTime != null) {
            orderTimeStr = Date_Util.dateToString(orderTime, "yyyy年MM月dd号 HH:mm:ss");
        }
        return orderTimeStr;
    }

    public String getOrderStatusStr() {
        if (orderStatus == 0) {
            orderStatusStr = "未支付";
        }
        if (orderStatus == 1) {
            orderStatusStr = "已支付";
        }
        return orderStatusStr;
    }
}
